package cn.edu.pku.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.edu.pku.dao.HumanDao;
import cn.edu.pku.dao.HumanmgtDao;
import cn.edu.pku.dao.UserDao;
import cn.edu.pku.model.Human;

import com.opensymphony.xwork2.ActionSupport;

public class DelHRRecordAction extends ActionSupport implements BaseAction {
	/**
	 * 
	 */
	private HttpServletRequest request;
	private HttpServletResponse response;
	private Map att;

	private HumanDao humanDao;
	private HumanmgtDao humanmgtDao;

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		HttpSession session = request.getSession();
		Object objId = request.getParameter("humanId");
		System.out.println("humanId---------"+objId);
		Integer humanId = Integer.parseInt((String) objId);
		//humanDao.delete(humanId);
		humanmgtDao.tDelete(humanId);
		request.setAttribute("pageNow", request.getParameter("pageNow"));
		request.setAttribute("SearchMethod", session.getAttribute("SearchMethod"));
		request.setAttribute("humanName", session.getAttribute("humanName"));
		request.setAttribute("gender", session.getAttribute("gender"));
		request.setAttribute("idNumber", session.getAttribute("idNumber"));
		request.setAttribute("account", session.getAttribute("account"));
		request.setAttribute("departmentId",session.getAttribute("departmentId"));
		request.setAttribute("positionId", session.getAttribute("positionId"));
		request.setAttribute("titleId", session.getAttribute("titleId"));
		request.setAttribute("department",session.getAttribute("department"));
		request.setAttribute("position", session.getAttribute("position"));
		request.setAttribute("title", session.getAttribute("title"));
		
		return SUCCESS;
	}

	

	public HumanmgtDao getHumanmgtDao() {
		return humanmgtDao;
	}



	public void setHumanmgtDao(HumanmgtDao humanmgtDao) {
		this.humanmgtDao = humanmgtDao;
	}



	public HumanDao getHumanDao() {
		return humanDao;
	}

	public void setHumanDao(HumanDao humanDao) {
		this.humanDao = humanDao;
	}

	@Override
	public void setServletRequest(HttpServletRequest request) {
		// TODO Auto-generated method stub
		this.request = request;
	}

	@Override
	public void setServletResponse(HttpServletResponse response) {
		// TODO Auto-generated method stub
		this.response = response;
	}

	@Override
	public void setSession(Map att) {
		// TODO Auto-generated method stub
		this.att = att;
	}
}
